home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swagd_f.zip / DRIVES.SWG / 0041_Disk Serial Numbers.pas < prev    next >
Pascal/Delphi Source File  |  1993-08-27  |  1KB  |  49 lines

  1. {
  2. PETER KLAPPROTH
  3.  
  4. > If anyone happens to know how to find the serial number
  5. > of a diskette, please let me know, code is nice :)
  6. > It is stored in byte 42, 41, 40, and 39 (counting the first one as
  7. > 0) of ths first sector of the disk.  The code I have for it uses the
  8. > TPro package to read the sector.
  9.  
  10. annother way to read/write the diskId is the following small peace of code.
  11. }
  12.  
  13. type
  14.   TInfoBuffer = record
  15.     InfoLevel : word; {may be 0}
  16.     Serial    : longInt;
  17.     VolLabel  : array [0..10] of char;
  18.     FileSystem: array [0..7] of char;
  19.   end;
  20.  
  21. function GetSerial(DiskNum : Byte; var I : TInfoBuffer) : word; assembler;
  22. asm
  23.   mov  ah, 69h
  24.   mov  al, 00h
  25.   mov  bl, DiskNum
  26.   push ds
  27.   lds  dx, I
  28.   int  21h
  29.   pop  ds
  30.   jc   @bad
  31.   Xor  ax, ax
  32.  @bad:
  33. end;
  34.  
  35. function SetSerial(DiskNum : Byte; var I : TInfoBuffer) : word; assembler;
  36. asm
  37.   mov  ah, 69h
  38.   mov  al, 01h
  39.   mov  bl, DiskNum
  40.   push ds
  41.   lds  dx, I
  42.   int  21h
  43.   pop  ds
  44.   jc   @bad
  45.   xor  ax, ax
  46.  @bad:
  47. end;
  48.  
  49.